<template>
  <div>
    <section>十大热门新闻排行</section>
    <div class="skeleton" v-show="newsList.length == 0" v-for="num in 10" :key="num">
      <a-spin tip="Loading...">
        <div class="spin-content">
          新闻正在载入。。。
        </div>
      </a-spin>
    </div>
    <ul>
      <li v-for="(item,index) in newsList"  :key="item.articleId" @click="toDetail(item.articleId)" >
        <div>
          <div><div><van-icon name="fire" color="#ee0a24" /><span :class="index<3?red:''">{{index+1}}、</span>{{ item.title }}</div></div>
          <span>{{item.articleSource}}</span>
          <span>{{item.createTime}}</span>
        </div>
        <img :src="item.imgList" alt="">
      </li>
    </ul>
    <footer></footer>
  </div>

</template>

<script>
export default {
  name: "HoutList",
  methods:{
    toDetail(articleId){
      this.$router.push({path:'/detail',query:{articleId:articleId}})
    }
  },
  data(){
    return{
      red:'red'
    }
  },
  props: {
    newsList: Array,
  },
  created() {
    // console.log(this.newsList)
  },

}
</script>

<style scoped lang="less">
.van-icon-fire{
  float: left;
  margin-right: 3px;
  margin-top: 5px;
}
.skeleton {
  div {
    height: 135px!important;
  }
}
/deep/.ant-spin-nested-loading > div > .ant-spin {
  z-index: 1;
}
.red{
  color: red;
}
section{
  height: 54px;
  text-align: center;
  background-color: red;
  color: white;
  font-size: 35px;
  font-family: cursive;
}
ul {

  >li {
    padding: 5px 15px 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    > div {
      width: calc(100% - 135px);
      > div {
        font-size: 18px;
        margin-bottom: 8px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        height: 58px;
        line-height: 30px;
span{
  font-weight: bolder;
}
      }
      > span:nth-of-type(1) {
        font-size: 14px;
        display: inline-block;
        width: calc(100% - 75px);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 700;
        color: #f5270c;
      }

      > span:nth-of-type(2) {
        font-size: 14px;
        display: inline-block;
        width: 75px;
        white-space: nowrap;
        overflow: hidden;
        float: right;
        color: #938d8d;
      }
    }
    >img{
      height: 100px;
      width: 125px;
      border-radius: 8px;
    }
  }
}
footer{
  height: 72px;
}
</style>